import java.util.Scanner;
import java.util.Arrays;
public class Day_14_2_幸运的袋子 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
            }
            Arrays.sort(arr);//排序
            System.out.println(find(arr, 0, 0, 1));
        }
    }


    private static int find(int[] arr, int index, long sum, int multi) {
        int count = 0;
        for (int i = index; i < arr.length; i++) {
            sum += arr[i];//求和
            multi *= arr[i];//求积
            if (sum > multi) {
                count += 1 + find(arr, i + 1, sum, multi);//继续遍历下一个数
            } else if (arr[i] == 1) {//若arr[i]=1，1和任何数的和>1和任何数的积
                count += find(arr, i + 1, sum, multi);
            } else {
                break;//说明不构成幸运，直接break
            }
            //回溯
            sum -= arr[i];
            multi /= arr[i];

            //因为相同的无区别，跳过重复的号码
            while (i < arr.length - 1 && arr[i] == arr[i + 1]) {
                i++;
            }
        }
        return count;
    }
}

